package org.fujene.sandbox;

import java.util.Map.Entry;
import java.util.TreeMap;

import org.junit.Test;

public class SandBox{
	@Test
	public void listTest(){
		TreeMap<Long, Integer> testmap = new TreeMap<Long, Integer>();
		testmap.put(Long.valueOf(0x0000000000000000L), Integer.valueOf(0));
		testmap.put(Long.valueOf(0x1000000000000000L), Integer.valueOf(100));
		testmap.put(Long.valueOf(0x2000000000000000L), Integer.valueOf(200));
		testmap.put(Long.valueOf(0x3000000000000000L), Integer.valueOf(300));
		testmap.put(Long.valueOf(0x4000000000000000L), Integer.valueOf(400));
		testmap.put(Long.valueOf(0x5000000000000000L), Integer.valueOf(500));
		testmap.put(Long.valueOf(0x6000000000000000L), Integer.valueOf(600));
		testmap.put(Long.valueOf(0x7000000000000000L), Integer.valueOf(700));
		testmap.put(Long.valueOf(0x8000000000000000L), Integer.valueOf(-800));
		testmap.put(Long.valueOf(0x9000000000000000L), Integer.valueOf(-700));
		testmap.put(Long.valueOf(0xA000000000000000L), Integer.valueOf(-600));
		testmap.put(Long.valueOf(0xB000000000000000L), Integer.valueOf(-500));
		testmap.put(Long.valueOf(0xC000000000000000L), Integer.valueOf(-400));
		testmap.put(Long.valueOf(0xD000000000000000L), Integer.valueOf(-300));
		testmap.put(Long.valueOf(0xE000000000000000L), Integer.valueOf(-200));
		testmap.put(Long.valueOf(0xF000000000000000L), Integer.valueOf(-100));
		
		Entry<Long, Integer> testentry = testmap.floorEntry(Long.valueOf(0));
		for(int i = 0; i < 30; i++){
			System.out.println("Value: " + testentry.getValue().intValue());
			testentry = testmap.lowerEntry(testentry.getKey());
			if(testentry == null) testentry = testmap.lastEntry();
		}
	}
}
